| Conditions | 6 |
| Total Lines | 29 |
| Code Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import {Event, EventType} from './Event.entity'; |
||
| 35 | |||
| 36 | public calculateNumberOfMealTicket( |
||
| 37 | overview: IEventsOverview, |
||
| 38 | eventsByDate: any[] |
||
| 39 | ): IEventsOverview { |
||
| 40 | for (const sortedEvent of eventsByDate) { |
||
| 41 | if (!sortedEvent) { |
||
| 42 | continue; |
||
| 43 | } |
||
| 44 | |||
| 45 | let totalPerDay = 0; |
||
| 46 | |||
| 47 | for (const {time, type} of sortedEvent) { |
||
| 48 | if ( |
||
| 49 | type !== EventType.WORK_FREE && |
||
| 50 | type !== EventType.MEDICAL_LEAVE && |
||
| 51 | type !== EventType.HOLIDAY && |
||
| 52 | type !== EventType.OTHER |
||
| 53 | ) { |
||
| 54 | totalPerDay += time; |
||
| 55 | } |
||
| 56 | } |
||
| 57 | |||
| 58 | if (totalPerDay > 0.5) { |
||
| 59 | overview.mealTicket++; |
||
| 60 | } |
||
| 61 | } |
||
| 62 | |||
| 63 | return overview; |
||
| 64 | } |
||
| 66 |